<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../struts_taglib.jsp"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>  
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
  <title>物资管理/购物地址</title>
  <%@ include file="../link_script.jsp" %>
<script type="text/javascript"> 
/*添加礼品*/
function add(){
    window.self.location="present.do?method=addPresent";
}
/*删除礼品*/
function del(){
    var flag = false;
    for (var i = 0; i < document.getElementsByName("ids").length; i++) {
        if (document.getElementsByName("ids")[i].checked) {
            flag = true;
        }
    }
    if (!flag) {
        alert("请选择需要删除的礼品！");
        return;
    }
    if (window.confirm("确认删除吗？")) {
    
        with (document.getElementById("list")) {
        
            method = "post";
            action = "present.do?method=delPresent";
            submit();
        }
    }
}
/*选择礼品，单选框*/
function selectAll(){
    if (list.checkbox.checked == true) {
        for (var i = 0; i < list.ids.length; i++) 
            list.ids[i].checked = true;
        if (list.ids.length == null) 
            list.ids.checked = true;
    }
    else {
        for (var i = 0; i < list.ids.length; i++) 
            list.ids[i].checked = false;
        if (list.ids.length == null) 
            list.ids.checked = false;
    }
}
/*编辑礼品*/
function edit(){
    var count = 0;
    var j = 0;
    for (var i = 0; i < document.getElementsByName("ids").length; i++) {
        if (document.getElementsByName("ids")[i].checked) {
            j = i;
            count++;
        }
    }
    if (count == 0) {
        alert("请选择需要修改的礼品！");
        return;
    }
    if (count > 1) {
        alert("一次只能修改一个礼品！");
        return;
    }
    if (count == 1) {
        window.self.location = "present.do?method=editPresent&presentID=" +
        document.getElementsByName("ids")[j].value;
    }
}
</script>
</head>
<body>
<html:form styleId="list" action="/present.do">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <%@ include file="../operate_button_list.jsp" %>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="8" background="images/tab_12.gif">&nbsp;</td>
        <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#b5d6e6">
          <tr>
            <td width="3%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">选择</span></div></td>
            <td width="3%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">序号</span></div></td>
            <td width="16%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">网站名称</span></div></td>
            <td width="3%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">网址</span></div></td>
            <td width="3%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">用户名</span></div></td>
            <td width="8%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">密码</span></div></td>
            <td width="8%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">价格/￥</span></div></td>
            <td width="5%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">卖家</span></div></td>
            <td width="40%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">描述</span></div></td>
            <td width="3%" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">结算</span></div></td>
            <td width="10%" height="22" background="images/bg.gif" bgcolor="#FFFFFF" class="STYLE1"><div align="center">常用操作</div></td>
            <td width="*" height="22" background="images/bg.gif" bgcolor="#FFFFFF"><div align="center"><span class="STYLE1">...</span></div></td>           
          </tr>
          <logic:notEmpty name="presentList">
          <% int i = 0; %>
            <logic:iterate id="var" name="presentList">
            <% i++; %>
              <tr>
                <td height="20" bgcolor="#FFFFFF"><div align="center"><input type="checkbox" name="ids" value="${var.presentID}" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><%=i %></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="left" class="STYLE1">&nbsp;&nbsp;<bean:write name="var" property="presentName" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><bean:write name="var" property="presentType" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><bean:write name="var" property="presentState" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><bean:write name="var" property="presentDate" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><bean:write name="var" property="presentExpenses" />￥</div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><bean:write name="var" property="presentVendor" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="left" class="STYLE1">&nbsp;&nbsp;<bean:write name="var" property="presentDesc" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1"><bean:write name="var" property="presentPay" /></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center"><span class="STYLE4"><a href="present.do?method=detailPresent&presentID=${var.presentID}">明细</a>
                &nbsp;&nbsp;<a href="present.do?method=payPresent&presentID=${var.presentID}">结算</a></span></div></td>
                <td height="20" bgcolor="#FFFFFF"><div align="center" class="STYLE1">&nbsp;&nbsp;</div></td>
              </tr>
            </logic:iterate>
          </logic:notEmpty>
        </table></td>
        <td width="8" background="images/tab_15.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <%@ include file="../no_page.jsp"%>
</table>
</html:form>
</body>
</html>

